package com.wanxi.web.controller;

import com.wanxi.enterprise.api.query.EnterpriseQuery;
import com.wanxi.enterprise.api.query.ShopQuery;
import com.wanxi.enterprise.api.result.CommonResult;
import com.wanxi.enterprise.api.vo.ShopAddInVo;
import com.wanxi.enterprise.api.vo.ShopUpdateInVo;
import com.wanxi.product.service.api.feign.ProductShopService;
import com.wanxi.web.service.shop.ShopWebService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * ClassName: EnterpriseShopController
 * Description:
 * date: 2022/1/13 17:00
 *
 * @author lxl
 * @version 1.0
 * @since JDK 1.8
 */
@Api(tags = "商家店铺接口")
@RestController
@RequestMapping("shops")
public class EnterpriseShopController {

    @Resource
    private ShopWebService service;


    /**
     * @Author jinfang
     * @Description // 商家查看旗下的店铺列表
     * @Date  2021/1/10
     * @Params shopQuery
     * @return CommonResult
     **/
    @GetMapping("enterprise/findShopAll")
    public CommonResult findShopAll(ShopQuery shopQuery){
        return service.findShopAll(shopQuery);
    }

    /**
     * @Author jinfang
     * @Description // 商家添加店铺
     * @Date  2021/1/10
     * @Params shopAddInVo
     * @return CommonResult
     **/
    @PostMapping("enterprise/addShop")
    public CommonResult addShop(ShopAddInVo shopAddInVo){
        return service.addShop(shopAddInVo);
    }

    /**
     * @Author jinfang
     * @Description // 商家根据id查看店铺
     * @Date  2021/1/18
     * @Params id
     * @return CommonResult
     **/
    @GetMapping("enterprise/findShopById")
    public CommonResult findShopById(Long id){
        return service.findShopById(id);
    }



    /**
     * @Author jinfang
     * @Description // 商家修改店铺信息
     * @Date  2021/1/10
     * @Params shopUpdateInVo
     * @return CommonResult
     **/
    @PutMapping("enterprise/updateShopById")
    public CommonResult updateShopById(ShopUpdateInVo shopUpdateInVo){
        return service.updateShopById(shopUpdateInVo);
    }

    /**
     * @Author jinfang
     * @Description // 商家逻辑删除店铺
     * @Date  2021/1/10
     * @Params id
     * @return CommonResult
     **/
    @PutMapping("enterprise/deleteShopById")
    public CommonResult deleteShopById(Long id){
        return service.deleteShopById(id);
    }


    
}
